from aiogram.dispatcher.middlewares import BaseMiddleware

from pyqiwip2p import QiwiP2P


class P2PMiddleware(BaseMiddleware):
    def __init__(self, p2p: QiwiP2P):
        super().__init__()
        self.p2p = p2p

    async def on_pre_process_message(self, _, data: dict):
        data["p2p"] = self.p2p

    async def on_pre_process_callback_query(self, _, data: dict,):
        data["p2p"] = self.p2p